<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Class: MIME E-mail message composing and sending using Sendmail</title>
</head>
<body>
<center><h1>Class: MIME E-mail message composing and sending using Sendmail</h1></center>
<hr />
<ul>
<p><b>Version:</b> <tt>@(#) $Id: sendmail_message.php,v 1.18 2010/08/08 07:50:26 mlemos Exp $</tt></p>
<h2><a name="table_of_contents">Contents</a></h2>
<ul>
<li><a href="#2.1.1">Summary</a></li>
<ul>
<li><a href="#3.2.0">Name</a></li>
<li><a href="#3.2.0.0">Author</a></li>
<li><a href="#3.2.0.1">Copyright</a></li>
<li><a href="#3.2.0.2">Version</a></li>
<li><a href="#3.2.0.3">Parent classes</a></li>
<li><a href="#4.2.0">Purpose</a></li>
<li><a href="#4.2.0.0">Usage</a></li>
</ul>
<li><a href="#5.1.1">Variables</a></li>
<ul>
<li><a href="#6.2.6">sendmail_path</a></li>
<li><a href="#6.2.7">delivery_mode</a></li>
<li><a href="#6.2.8">bulk_mail_delivery_mode</a></li>
<li><a href="#6.2.9">sendmail_arguments</a></li>
<li><a href="#6.2.10">mailer_delivery</a></li>
</ul>
<li><a href="#7.1.1">Inherited variables</a></li>
<li><a href="#9.1.1">Functions</a></li>
<li><a href="#11.1.1">Inherited functions</a></li>
</ul>
<p><a href="#table_of_contents">Top of the table of contents</a></p>
</ul>
<hr />
<ul>
<h2><li><a name="2.1.1">Summary</a></li></h2>
<ul>
<h3><a name="3.2.0">Name</a></h3>
<p>MIME E-mail message composing and sending using Sendmail</p>
<h3><a name="3.2.0.0">Author</a></h3>
<p>Manuel Lemos (<a href="mailto:mlemos-at-acm.org">mlemos-at-acm.org</a>)</p>
<h3><a name="3.2.0.1">Copyright</a></h3>
<p>Copyright &copy; (C) Manuel Lemos 1999-2004</p>
<h3><a name="3.2.0.2">Version</a></h3>
<p>@(#) $Id: sendmail_message.php,v 1.18 2010/08/08 07:50:26 mlemos Exp $</p>
<h3><a name="3.2.0.3">Parent classes</a></h3>
<ul>
<p><li>MIME E-mail message composing and sending</li></p>
<p><b>Version:</b> <tt>@(#) $Id: email_message.php,v 1.92 2011/01/28 06:32:16 mlemos Exp $</tt></p>
</ul>
<h3><a name="4.2.0">Purpose</a></h3>
<p>Implement an alternative message delivery method using <a href="http://www.sendmail.org/">Sendmail</a> MTA (Mail Transfer Agent). This class can also be used with other MTAs like <a href="http://www.exim.org/">Exim</a>, <a href="http://www.postfix.org/">Postfix</a> and <a href="http://www.qmail.org/">Qmail</a>, as they provide a wrapper commands that emulate the <tt>sendmail</tt> command.</p>
<h3><a name="4.2.0.0">Usage</a></h3>
<p>This class should be used exactly the same way as the base class for composing and sending messages. Just create a new object of this class as follows and set only the necessary variables to configure details of delivery using Sendmail.</p>
<p> <tt>require('email_message.php');<br />
 require('sendmail_message.php');<br />
 <br />
 $message_object = new sendmail_message_class;<br />
</tt></p>
<p> <b>- Tuning the delivery mode for mass mailing</b></p>
<p> Sendmail supports several message delivery modes. In many installations the default is to attempt to deliver the message right away when the message is handed by the applications to Sendmail.</p>
<p> This may be an inconvenient because it makes PHP scripts wait for the message to be delivered to the destination SMTP server. If the SMTP connection with that server is slow, it may stall the delivery for a long while.</p>
<p> Under Unix/Linux, PHP defaults to using Sendmail or equivalent to deliver messages sent with the <tt>mail()</tt> function. Some people assume that it is faster to queue messages by relaying to an intermediate SMTP server than to use the <tt>mail()</tt> function that uses Sendmail. This is not accurate.</p>
<p> Sendmail supports other message delivery modes that can be used for much faster message queueing. These modes are more recommended for mass mailing. Adjust the value of the <tt><a href="#variable_delivery_mode">delivery_mode</a></tt> variable to improve the message queueing rate if you want to use this class for mass mailing.</p>
<p> Alternatively, you may also call the <tt><a href="#function_SetBulkMail">SetBulkMail</a></tt> to hint this class to use a delivery mode more suitable for bulk mailing. Currently, this makes this class use the delivery mode specified by the <tt><a href="#variable_bulk_mail_delivery_mode">bulk_mail_delivery_mode</a></tt> variable, which defaults to make the messages be queued for later delivery, thus making the calling script execute much faster.</p>
<p><a href="#table_of_contents">Table of contents</a></p>
</ul>
</ul>
<hr />
<ul>
<h2><li><a name="variables"></a><a name="5.1.1">Variables</a></li></h2>
<ul>
<li><tt><a href="#variable_sendmail_path">sendmail_path</a></tt></li><br />
<li><tt><a href="#variable_delivery_mode">delivery_mode</a></tt></li><br />
<li><tt><a href="#variable_bulk_mail_delivery_mode">bulk_mail_delivery_mode</a></tt></li><br />
<li><tt><a href="#variable_sendmail_arguments">sendmail_arguments</a></tt></li><br />
<li><tt><a href="#variable_mailer_delivery">mailer_delivery</a></tt></li><br />
<p><a href="#table_of_contents">Table of contents</a></p>
<h3><a name="variable_sendmail_path"></a><li><a name="6.2.6">sendmail_path</a></li></h3>
<h3>Type</h3>
<p><tt><i>string</i></tt></p>
<h3>Default value</h3>
<p><tt>'/usr/lib/sendmail'</tt></p>
<h3>Purpose</h3>
<p>Specifying the path of the <tt>sendmail</tt> executable program.</p>
<h3>Usage</h3>
<p>The original default path of the <tt>sendmail</tt> used to be <tt>/usr/lib/sendmail</tt>. However, currently it is usually located in <tt>/usr/sbin/sendmail</tt> having a symbolic link pointing to that path from <tt>/usr/lib/sendmail</tt>.</p>
<p> If this symbolic link does not exist or the <tt>sendmail</tt> is different in your installation, you need to change this variable.</p>
<p><a href="#variables">Variables</a></p>
<h3><a name="variable_delivery_mode"></a><li><a name="6.2.7">delivery_mode</a></li></h3>
<h3>Type</h3>
<p><tt><i>string</i></tt></p>
<h3>Default value</h3>
<p><tt>''</tt></p>
<h3>Purpose</h3>
<p>Specify the Sendmail message delivery mode. These delivery modes are only supported by Sendmail and Exim MTAs.</p>
<p> Current versions of Qmail and Postfix do not support configurable delivery modes. They always inject the messages in the local queue and let their queue management system take care of the delivery as soon as possible. Just leave this variable with the default value when using this class with these MTAs.</p>
<h3>Usage</h3>
<p>Sendmail supports several different delivery modes:</p>
<p> SENDMAIL_DELIVERY_DEFAULT - <tt>''</tt></p>
<p> Does not override the default mode.</p>
<p> SENDMAIL_DELIVERY_INTERACTIVE - <tt>'i'</tt></p>
<p> Attempt to send the messages synchronously to the recipient's SMTP server and only returns when it succeeds or fails. This is usually the default mode. It stalls the delivery of messages but it may be safer to preserve disk space because the successfully delivered messages are not stored.</p>
<p> SENDMAIL_DELIVERY_BACKGROUND - <tt>'b'</tt></p>
<p> Creates a background process that attempts to deliver the message and returns immediately. This mode is recommended when you want to send a few messages as soon as possible. It is not recommended for sending messages to many recipients as it may consume too much memory and CPU that result from creating excessive background processes.</p>
<p> SENDMAIL_DELIVERY_QUEUE - <tt>'q'</tt></p>
<p> Just drop the message in the queue and leave it there until next time the queue is run. It is recommended for deliverying messages to many recipients as long as there is enough disk space to store all the messages in the queue.</p>
<p> SENDMAIL_DELIVERY_DEFERRED - <tt>'d'</tt></p>
<p> The same as the queue mode except for a few verifications that are skipped.</p>
<p> </p>
<p><a href="#variables">Variables</a></p>
<h3><a name="variable_bulk_mail_delivery_mode"></a><li><a name="6.2.8">bulk_mail_delivery_mode</a></li></h3>
<h3>Type</h3>
<p><tt><i>string</i></tt></p>
<h3>Default value</h3>
<p><tt>'q'</tt></p>
<h3>Purpose</h3>
<p>Specify the Sendmail message delivery mode when the class is in bulk mail mode that is set with the <tt><a href="#function_SetBulkMail">SetBulkMail</a></tt> function.</p>
<h3>Usage</h3>
<p>The available delivery modes are the same as those used to set the <tt><a href="#variable_delivery_mode">delivery_mode</a></tt> variable. The default bulk mail delivery mode is to just queue the message (<tt>SENDMAIL_DELIVERY_QUEUE</tt>) without waiting for sendmail to deliver the message.</p>
<p> Note that some MTAs that emulate Sendmail return an error when set to queue delivery mode. If this happens with the MTA that you are using, change this variable to the <tt>SENDMAIL_DELIVERY_DEFAULT</tt>.</p>
<p><a href="#variables">Variables</a></p>
<h3><a name="variable_sendmail_arguments"></a><li><a name="6.2.9">sendmail_arguments</a></li></h3>
<h3>Type</h3>
<p><tt><i>string</i></tt></p>
<h3>Default value</h3>
<p><tt>''</tt></p>
<h3>Purpose</h3>
<p>Specify additional <tt>sendmail</tt> program arguments.</p>
<h3>Usage</h3>
<p>Use this to to pass additional arguments that are not supported by this class.</p>
<p><a href="#variables">Variables</a></p>
<h3><a name="variable_mailer_delivery"></a><li><a name="6.2.10">mailer_delivery</a></li></h3>
<h3>Type</h3>
<p><tt><i>string</i></tt></p>
<h3>Default value</h3>
<p><tt>'sendmail $Revision: 1.18 $'</tt></p>
<h3>Purpose</h3>
<p>Specify the text that is used to identify the mail delivery class or sub-class. This text is appended to the <tt>X-Mailer</tt> header text defined by the mailer variable.</p>
<h3>Usage</h3>
<p>Do not change this variable.</p>
<p><a href="#variables">Variables</a></p>
<p><a href="#table_of_contents">Table of contents</a></p>
</ul>
</ul>
<ul>
<h2><li><a name="functions"></a><a name="7.1.1">Inherited variables</a></li></h2>
<ul>
<li>email_regular_expression</li><br />
<li>mailer</li><br />
<li>default_charset</li><br />
<li>line_quote_prefix</li><br />
<li>break_long_lines</li><br />
<li>file_buffer_length</li><br />
<li>debug</li><br />
<li>cache_body</li><br />
<li>error</li><br />
<li>localhost</li><br />
<p><a href="#table_of_contents">Table of contents</a></p>
</ul>
</ul>
<hr />
<ul>
<h2><li><a name="functions"></a><a name="9.1.1">Functions</a></li></h2>
<ul>
<p><a href="#table_of_contents">Table of contents</a></p>
<p><a href="#table_of_contents">Table of contents</a></p>
</ul>
</ul>
<ul>
<h2><li><a name="functions"></a><a name="11.1.1">Inherited functions</a></li></h2>
<ul>
<li>ValidateEmailAddress</li><br />
<li>WrapText</li><br />
<li>CenterText</li><br />
<li>Ruler</li><br />
<li>QuoteText</li><br />
<li>SetHeader</li><br />
<li>SetEncodedHeader</li><br />
<li>SetEncodedEmailHeader</li><br />
<li>SetMultipleEncodedEmailHeader</li><br />
<li>ResetMessage</li><br />
<li>AddPart</li><br />
<li>ReplacePart</li><br />
<li>CreatePlainTextPart</li><br />
<li>AddPlainTextPart</li><br />
<li>CreateQuotedPrintableTextPart</li><br />
<li>AddQuotedPrintableTextPart</li><br />
<li>CreateHTMLPart</li><br />
<li>AddHTMLPart</li><br />
<li>CreateQuotedPrintableHTMLPart</li><br />
<li>AddQuotedPrintableHTMLPart</li><br />
<li>CreateFilePart</li><br />
<li>AddFilePart</li><br />
<li>CreateMessagePart</li><br />
<li>AddMessagePart</li><br />
<li>CreateAlternativeMultipart</li><br />
<li>AddAlternativeMultipart</li><br />
<li>CreateRelatedMultipart</li><br />
<li>AddRelatedMultipart</li><br />
<li>CreateMixedMultipart</li><br />
<li>AddMixedMultipart</li><br />
<li>GetPartContentID</li><br />
<li>GetDataURL</li><br />
<li>Send</li><br />
<li>GetMessage</li><br />
<li>GetMessageSize</li><br />
<li>Mail</li><br />
<li>SetBulkMail</li><br />
<p><a href="#table_of_contents">Table of contents</a></p>
</ul>
</ul>

<hr />
<address>Manuel Lemos (<a href="mailto:mlemos-at-acm.org">mlemos-at-acm.org</a>)</address>
</body>
</html>
